package com.UBC417.termproject.Servlet;

import java.io.IOException;
import java.util.logging.Logger;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.UBC417.termproject.Data.Buyer;
import com.UBC417.termproject.Data.Comment;

@SuppressWarnings("serial")
public class CommentServlet extends HttpServlet{
private static final Logger log = Logger.getLogger(SubscribeServlet.class.getName());
	
	public void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws IOException, ServletException {
		
		// Get parameters		
		String sellerId = req.getParameter("sellerId");
		String content = req.getParameter("comment");
		
		HttpSession session = req.getSession();
		String buyerId = (String) session.getAttribute("id");
		
		//String forwardTo = "/?.jsp";
				
		log.info("sellerId: "+ sellerId);
		log.info ("content: "+ content);
		
		Comment c = Buyer.SetComment(buyerId, sellerId, content);
		
		// TODO: display comment
		
	}

}
